<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">
        <script>
        function recupererTexte () {
            var champResultat = document.getElementById("champResultat");
            
            var texteListe = document.getElementById("document").childNodes[3].childNodes[3].firstChild.nodeValue;
            //var texteListe = document.getElementById("document").childNodes[5].childNodes[3].value;
            
            champResultat.value = texteListe;
            
            
        }
       
        /*
        SCHEMA DU DOM DE CETTE PAGE
        - BODY (noeud 1)
            -#TEXT
            -H1 (noeud 1.1)
                -#TEXT
            -#TEXT
            -UL (noeud 1.2)
                -#TEXT
                -LI (noeud 1.2.1)
                    -#TEXT
                -LI (noeud 1.2.2)
                    -#TEXT
                -LI (noeud 1.2.3)
                    -#TEXT
                -LI (noeud 1.2.4)
                    -#TEXT
            -#TEXT        
            -FORM (noeud 1.3)
                -#TEXT
                -INPUT (noeud 1.3.1)
                    -#TEXT
                -#TEXT
                -INPUT (noeud 1.3.2)
                    -#TEXT
                -#TEXT
            -#TEXT
         */
         /* Attention le DOM doit être construit avant de manipuler !!!*/
        </script>
    </head>
    
    <body id="document">
        <h1>Titre du document</h1>
        <ul >
           <li >Valeur liste 1</li> 
           <li>Valeur liste 2</li> 
           <li>Valeur liste 3</li> 
           <li>Valeur liste 4</li> 
        </ul>
        <form name="form1" action="">
            <input type="text" name="champResultat" id="champResultat" value="">
            <input type="button" value="Récupérer le texte !" onclick="recupererTexte()">
        </form>
    </body>
</html>
